//
//  ExercisesQuqestionOtherTitleCell.m
//  ShowYork
//
//  Created by hxh on 2020/9/8.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "ExercisesQuqestionChoiceOtherTitleCell.h"

@interface ExercisesQuqestionChoiceOtherTitleCell ()
@property (nonatomic,strong)UIView *containView;
@property (nonatomic,strong)UILabel *contentLb;
@end

@implementation ExercisesQuqestionChoiceOtherTitleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}
- (void)setUI{
    self.containView = [[UIView alloc]init];
    [self.contentView addSubview:self.containView];
        
    [self.containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(16);
        make.right.equalTo(self.contentView).offset(-16);
        make.top.equalTo(self.contentView).offset(24);
        make.bottom.equalTo(self.contentView).offset(-16);
    }];
     
     
        
    self.contentLb = [[UILabel alloc]init];
    //    self.contentLb.text = @"如果心灵的窗户被“关”上了，或者蒙了尘，这些近视的学生，不仅无法更好地拥有出彩人生，也看不清美丽未来";
    self.contentLb.textColor = RGBA(102, 102, 102, 1);
    self.contentLb.font = font(14);
    self.contentLb.numberOfLines = 0;
    [self.containView addSubview:self.contentLb];
        
    [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.containView);
        make.right.equalTo(self.containView);
        make.top.equalTo(self.containView);
        make.bottom.equalTo(self.containView);
   
    }];
    
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    NSString *ID = @"ExercisesQuqestionChoiceOtherTitleCell";
    ExercisesQuqestionChoiceOtherTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[ExercisesQuqestionChoiceOtherTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)setModel:(ExercieseQuestionItemModel *)model{
    _model = model;
    
    [[HTMLHelper alloc]attributedTextFromHTML:model.title andCompleteBlock:^(NSMutableAttributedString *content) {
        self.contentLb.attributedText = content;
        if (self.updateTableViewFrame) {
            self.updateTableViewFrame();
        }
    }];
}
@end
